/**
 * Created with WebStorm.
 * User: Administrator
 * Date: 2018/6/11
 * Time: 14:24
 * To change this template use File | Settings | File Templates.
 */
$(document).ready(function () {
//    锚点移动
    $(".nav-item").click(function() {
        var index = $(this).index();
        if(index>0){
            $("html, body").animate({
                scrollTop: $($(this).attr("href")).offset().top-100 + "px"
            }, {
                duration: 1000,
                easing: "swing"
            });
            return false;
        }else {
            $("html, body").animate({
                scrollTop: $($(this).attr("href")).offset().top + "px"
            }, {
                duration: 1000,
                easing: "swing"
            });
            return false;
        }
    });
    $("#logo").click(function(){
        $("html, body").animate({
            scrollTop: "0px"
        }, {
            duration: 1000,
            easing: "swing"
        });
        return false;
    });

    var name = ".nav-box";
    $(window).scroll(function() {
        var top = $(document).scrollTop();
        if(top>400){
            $(name).addClass('nav-fixed');
        }else {
            $(name).removeClass('nav-fixed');
        }
    });

    var top = $(document).scrollTop();
    if(top>400){
        $(name).addClass('nav-fixed');
    }else {
        $(name).removeClass('nav-fixed');
    }





});
